<?php

namespace Drupal\shushengyuan\Schemas;

use Drupal\shusy_hotel\Entity\ShusyHotelRoom;

class HotelRoomItem extends AbstractBaseModel {

  protected function getEntityType() {
    return 'shusy_hotel_room';
  }

  protected function setValue() {
    if ($this->entity instanceof ShusyHotelRoom) {
      $value = [
        'id' => (int) $this->entity->id,
        'month' => $this->formatDate(REQUEST_TIME, 'Y-m'),
        'name' => (string) $this->entity->name,
        'amount' => $this->convertYuan($this->entity->amount),
        'area' => (string) $this->entity->area,
        'bed' => (string) $this->entity->bed,
        'summary' => (string) $this->entity->summary,
        'number' => (int) $this->entity->rooms,
        'imgs' => $this->getImgs($this->wrapper->field_images),
      ];
      $this->merge($value);
    }
  }

}
